package com.ehotting.edsta.circuitDesign.gen.element.script;

import com.ehotting.edsta.circuitDesign.domain.EsCircuitCodeDataTemplate;
import com.ehotting.edsta.circuitDesign.domain.EsRuleScript;
import com.ehotting.edsta.circuitDesign.domain.EsSceneParam;
import com.ehotting.edsta.circuitDesign.gen.element.enums.ScriptTypeEnum;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CustomElementScript extends ElementScriptAbstract {

    // -----------自定义-----------

    // 2：自定义脚本
    public String invoke(EsRuleScript esRuleScript, List<EsCircuitCodeDataTemplate> inputParamList, List<EsSceneParam> outputParamList, String functionName){
        // 1、定义方法头部
        StringBuffer buf = new StringBuffer(functionStart( functionName, inputParamList));

        buf.append(esRuleScript.getContent());

        // 1、方法结束
        buf.append("}");
        return buf.toString();
    }


    public boolean isTrue(ScriptTypeEnum code){
        return ScriptTypeEnum.CUSTOM == code ;
    }

    @Override
    public String getExample() {
        return null;
    }

}
